﻿using System;
using Moq;
using Myotragus.Data.Criteria;
using Myotragus.Data.Tests.Domain;
using NHibernate;
using NHibernate.Criterion;
using NUnit.Framework;

namespace Myotragus.Data.Tests.Tests.Criteria
{
	[TestFixture]
	public class CriteriaQueryFixtures
	{
		[Test]
		public void CreateQuery()
		{
		}

		[Test]
		public void OrderByExpression()
		{
			var criteria = new Mock<ICriteria>();

			criteria.Setup(m => m.List()).Returns(new ITestEntity[0]);
			criteria.Setup(m => m.AddOrder(It.IsAny<Order>()))
				.Callback<Order>(Console.WriteLine);

			var query = new CriteriaQuery<ITestEntity>(criteria.Object);
			query.SetOrderByExpression("column1 asc", "column2 desc, column3").Execute();

			criteria.VerifyAll();
		}
	}
}